using Pinwheel.LSerialize;

namespace Pinwheel.Kernel.Builtin
{
    public abstract class ClientAgentBase : ServiceBase, IClientAgent
    {
        protected IConnection m_Connection;
        public ServiceStatus Status { get; set; }
        
        public void Create(IServiceManager serviceManager, IConnection connection)
        {
            m_ServiceManager = serviceManager;
            m_Connection = connection;
        }
        
        public async Task Send<TMessage>(TMessage message) where TMessage : IMessage
        {
            var data = LSerializer.Serialize(ref message);
            // await m_Connection.SendAsync(data);
        }

        public void Disconnect()
        {
            m_Connection.Close();
        }
    }
}